package com.hex.ds.hdrs.app.dao;

import com.hex.bigdata.hbda.base.BaseDao;
import com.hex.bigdata.hbda.base.Page;
import com.hex.ds.hdrs.app.po.GroupConf;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class GroupConfDao extends BaseDao {


    /**
     * 分页查询
     *
     * @param map
     * @param page
     * @return
     */
    public List<GroupConf> selectPages(Map map, Page page) {
        return this.selectPage(GroupConf.class, "com.hex.ds.hdrs.app.dao.GroupConfDao.qry", page, map);
    }

    /**
     * 获取所有应用组
     * @return
     */
    public List<GroupConf> selectAllGroupConf() {
        return this.selectList(GroupConf.class, "com.hex.ds.hdrs.app.dao.GroupConfDao.qry");
    }

    /**
     * 应用组添加
     *
     * @param groupConf
     * @return
     */
    public int add(GroupConf groupConf) {
        return this.insert("com.hex.ds.hdrs.app.dao.GroupConfDao.insert", groupConf);
    }

    /**
     * 应用组删除
     *
     * @param pkId
     */
    public void del(String pkId) {
        this.delete("com.hex.ds.hdrs.app.dao.GroupConfDao.delete", pkId);
    }

    /**
     * 应用组修改
     *
     * @param groupConf
     * @return
     */
    public int edit(GroupConf groupConf) {
        return this.update("com.hex.ds.hdrs.app.dao.GroupConfDao.update", groupConf);
    }

    /**
     * 应用组查重
     *
     * @param map
     * @return
     */
    public GroupConf checkAppGroupData(Map map) {
        return this.selectOne(GroupConf.class, "com.hex.ds.hdrs.app.dao.GroupConfDao.checkAppGroupData", map);
    }

    /**
     * 通过应用组编码查询应用
     *
     * @return
     */
    public List<GroupConf> qryGroupCode() {
        return this.selectList(GroupConf.class, "com.hex.ds.hdrs.app.dao.GroupConfDao.qryGroupCode");
    }

    /**
     * 通过id查找组编码
     *
     * @param pkId
     * @return
     */
    public GroupConf qryGroupCodeByPkId(String pkId) {
        return this.selectOne(GroupConf.class, "com.hex.ds.hdrs.app.dao.GroupConfDao.qryGroupCodeByPkId", pkId);
    }

    public GroupConf qryGroupCodeByGroupCode(String groupCode){
        return this.selectOne(GroupConf.class, "com.hex.ds.hdrs.app.dao.GroupConfDao.qryGroupCodeByGroupCode", groupCode);
    }
}